Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ModWeaponVars #803

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

feat: ModWeaponVars #803

wants to merge 3 commits into from

Conversation

EladNLG
Copy link
Member

@EladNLG EladNLG commented May 6, 2024

The script part of the ModWeaponVars feature. Relies on Launcher#691

Usage

AddCallback_ApplyModWeaponVars( int priority, void functionref( entity ) callback ) adds a callback whenever we want to calculate weaponvars.

Then, you use ModWeaponVar_Set[type]( entity weapon, int weaponVar, [type] value )

We need a priority parameter because some operations override existing weapon variables (as in, setting a new value, and ignoring the current value), some add (as in, newValue = prevValue + modifier) and others multiply (as in, newValue = prevValue * modifier).

We generally want to go in the order of Overrides > Additives > Multipliers to avoid as many conflicts as possible (additives come before multipliers because multipliers are generally intended to multiply the entire result, and not have additions after them), and that's reflected in the WEAPON_VAR_PRIORITY_XXX constants.

@GeckoEidechse GeckoEidechse added needs testing Changes from the PR still need to be tested needs code review Changes from PR still need to be reviewed in code feedback wanted Feedback is wanted whether the changes by this PR are desired labels Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feedback wanted Feedback is wanted whether the changes by this PR are desired needs code review Changes from PR still need to be reviewed in code needs testing Changes from the PR still need to be tested
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants